# 会话保持加通用的这个session的所有request的基础属性
import requests

# from requests_html import HTMLSession
# new_session = HTMLSession()
new_session = requests.Session()
new_session.headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "Accept-Language": "en-US,en;q=0.5",
    "Accept-Encoding": "gzip, deflate",
    # "Host": self.domain,
    "Connection": "keep-alive",
    "Upgrade-Insecure-Requests": "1",
    "Pragma": "no-cache",
    "Cache-Control": "no-cache",
}
proxyAddress = str("socks5h://proxyuser:yu1230.1230.@11.239.237.115:9054")  # http://11.239.237.115:9054
# proxyAddress = str("socks5h://11.239.237.115:9054")  # http://11.239.237.115:9054
tor_proxy = "socks5h://127.0.0.1:9150"
new_session.proxies = {"http": proxyAddress,
                       "https": proxyAddress}
new_session.timeout = 30
new_session.verify = False
# url = "https://www.google.com/"
# url = "https://www.baidu.com/"
url = "http://deepcnxpfgmausrq.onion"
r = new_session.get(url, verify=False)
print(r.text)

proxies = {
    'http': proxyAddress,
    'https': proxyAddress,
}
# try:
# response = requests.get("https://www.google.com/", proxies=proxies)
# print(response.text)
# except requests.exceptions.ConnectionError as e:
#     print("Error", e.args)
